package com.test.thread;

import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;

public class HowToCreateThread {
    static class MyRunnable implements Runnable{
        @Override
        public void run() {
            System.out.println("new runnable");
        }
    }

    static class MyThread extends Thread{
        @Override
        public void run() {
            System.out.println("new thread");
        }
    }

    /**
     * how to run a thread:
     * 1. new thread
     * 2. implements runnable
     * 3. use Executor.newCacheThread(not a new method)
     * @param args
     */
    public static void main(String[] args) {
        new MyThread().start();
        new Thread(new MyRunnable()).start();
        new Thread(() -> {
            System.out.println("new lambda");
        }).start();
    }
}
